package com.yqy.controller;

import com.yqy.entity.User;
import com.yqy.mapper.UserMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author yiqianyyi
 * @version 1.0
 * @date 2022-03-15 21:33
 * @deprecated 用于测试的controller
 */
@RestController
@CrossOrigin
@Api(tags = {"测试的控制层"})
public class DemoController {

    @Autowired
    private UserMapper userMapper;

    @GetMapping("/demo")
    @ApiOperation(value = "a demo ==> return hello world", notes = "return hello world")
    public String demo() {
        return "hello world";
    }

    @GetMapping("/mapperTest")
    @ApiOperation(value = "获取所有用户", notes = "get all user")
    public List<User> mapper(){
         return userMapper.selectList(null);
    }
}
